﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Collections.ObjectModel;
using System.Windows.Media;
using System.Xml.Serialization;

namespace WPFEdit.ViewModels
{
    public class TreeViewItem : INotifyPropertyChanged
    {
        protected bool m_isSelected, m_isExpanded;
        protected ObservableCollection<TreeViewItem> m_children;
        protected string m_name = String.Empty;
        protected ImageSource m_imagePath;
        private ObservableCollection<MenuItem> m_contextMenuItems = new ObservableCollection<MenuItem>();

        [XmlIgnore]
        public ObservableCollection<MenuItem> ContextMenuItems
        {
            get { return m_contextMenuItems; }
            set { m_contextMenuItems = value; }
        }

        [XmlIgnore]
        public ImageSource ImagePath
        {
            get { return m_imagePath; }
            set { if (m_imagePath != value) { m_imagePath = value; if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("ImagePath")); } }
        }

        public string Name
        {
            get { return m_name; }
            set { if (m_name != value) { m_name = value; if (PropertyChanged != null)  PropertyChanged(this, new PropertyChangedEventArgs("Name")); } }
        }

        public ObservableCollection<TreeViewItem> Children
        {
            get { return m_children; }
            set { if (m_children != value) { m_children = value; if (PropertyChanged != null)  PropertyChanged(this, new PropertyChangedEventArgs("TreeChildren")); } }
        }

        [XmlIgnore]
        public bool IsExpanded
        {
            get { return m_isExpanded; }
            set { if (m_isExpanded != value) { m_isExpanded = value; if (PropertyChanged != null)  PropertyChanged(this, new PropertyChangedEventArgs("IsExpanded")); } }
        }

        [XmlIgnore]
        public bool IsSelected
        {
            get { return m_isSelected; }
            set { if (m_isSelected != value) { m_isSelected = value; if (PropertyChanged != null)  PropertyChanged(this, new PropertyChangedEventArgs("IsSelected")); } }
        }



        public event PropertyChangedEventHandler PropertyChanged;
    }
}
